package symbolTable;

import java.util.ArrayList;
import syntaxtree.*;

public class StoreClass {
	public String name;
	public String extendClass;
	public ArrayList<StoreMethod> methodList = new ArrayList<StoreMethod>();
	public ArrayList<StoreVariable> attributeList = new ArrayList<StoreVariable>();
	
	public void addMethod(String methodName, Type returnType){
		StoreMethod m = new StoreMethod();
		m.name = methodName;
		m.returnType = returnType;
		methodList.add(m);
	}
	
	public void addVariable(String name, Type type){
		StoreVariable v = new StoreVariable();
		v.name = name;
		v.type = type;
		attributeList.add(v);
	}
	
	public StoreMethod findMethod(String name){
		for(int i=0; i<methodList.size(); i++) //encontra a posicao
			if(methodList.get(i).name == name)
				return methodList.get(i);
		return null; //se nao achou
		
	}
	
	public StoreVariable findVariable(String name){
		for(int i=0; i<attributeList.size(); i++) //encontra a posicao
			if(attributeList.get(i).name == name)
				return attributeList.get(i);
		return null; //se nao achou
		
	}
}
